import 'dart:io';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_magic_planet/common/translation.dart';
import 'package:flutter_magic_planet/component/toast.dart';
import 'package:get/get.dart';

import 'common/app_router.dart';

void main() {
  runApp(MyApp());
  Toast.initConfig();
  if (Platform.isAndroid) {
    SystemUiOverlayStyle systemUiOverlayStyle =
        SystemUiOverlayStyle(statusBarColor: Colors.transparent);
    SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
  }
  WidgetsFlutterBinding.ensureInitialized();
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      enableLog: true,
      debugShowCheckedModeBanner: false,
      initialRoute: AppRouter.main,
      getPages: AppRouter.getPages,
      builder: Toast.build(),
      translations: Translation(),
      locale: window.locale,
      fallbackLocale: Locale('en', 'US'),
    );
  }
}
